<?php
/**
 * Created by PhpStorm.
 * User: yuliang
 * Date: 2017/10/27
 * Time: 下午3:20
 */
namespace app\common\model;


use think\Db;
use think\Model;

class Group extends Model
{
    protected $table = 'tv_account_group';

    protected $autoWriteTimestamp = 'datetime';

    public function child($ids){
        $map['id'] = ['in',trim($ids,',')];
        $map['status'] = ['eq',1];
        $child = Db::name('account')->field('result,create_time,password,update_time',true)->where($map)->select();
        $platform = Db::name('platform')->field('id,logo')->select();
        $logo = array_column($platform,'logo','id');
        if(!empty($child)){
            foreach ($child as $key=>$value){
                $child[$key]['logo'] = $logo[$value['platform']];
            }
        }else{
            $child = array();
        }
        return $child;
    }

}